package com.kgc.rb.controller;

import com.kgc.rb.dto.RbResult;
import com.kgc.rb.service.LocalOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class OrderController {

    @Autowired
    private LocalOrderService orderService;

    @RequestMapping(value="/v/queryOrderList",method= RequestMethod.POST)
    public RbResult queryOrderListByToken(String token) throws Exception{
        RbResult rbResult = orderService.queryOrderListByUser(token);
        return rbResult;
    }

    @RequestMapping(value="/v/prepay",method=RequestMethod.POST)
    public RbResult prefixPay(String token,String orderId) throws Exception{
        RbResult rbResult = orderService.findOrderByCondition(token,orderId);
        return rbResult;
    }
}
